<html>
<head><meta charset="utf-8"><title>const generics · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html">const generics</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="193715251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715251">(Apr 12 2020 at 14:24)</a>:</h4>
<p>so I have some questions about const generics</p>



<a name="193715375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715375">(Apr 12 2020 at 14:28)</a>:</h4>
<p>a) does the structural match property mean that the type of a constant never has a type variable in it?</p>



<a name="193715593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715593">(Apr 12 2020 at 14:35)</a>:</h4>
<p>b) can types of constants meaningfully partake in type inference? if they can, should they?</p>



<a name="193715594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715594">(Apr 12 2020 at 14:35)</a>:</h4>
<p>/me summons <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="193715757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715757">(Apr 12 2020 at 14:41)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> for the time being, const generic types will have to be fully known</p>



<a name="193715762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715762">(Apr 12 2020 at 14:41)</a>:</h4>
<p>lifetime parameters used in those types <em>might</em> be easy to support</p>



<a name="193715808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715808">(Apr 12 2020 at 14:42)</a>:</h4>
<p>type parameters used in const parameter types would require some trait to bound them IMO</p>



<a name="193715813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715813">(Apr 12 2020 at 14:43)</a>:</h4>
<p>but also, we don't handle inference variables in those types well so it would likely break in weird ways</p>



<a name="193715814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715814">(Apr 12 2020 at 14:43)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> do you have an usecase in mind?</p>



<a name="193715819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715819">(Apr 12 2020 at 14:43)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="121053">@varkor</span> <span class="user-mention" data-user-id="218608">@yodal</span></p>



<a name="193715891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715891">(Apr 12 2020 at 14:44)</a>:</h4>
<p>Not really, I was just wondering if const types have inference variables (and/or type variables) in them while deducting types</p>



<a name="193715898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715898">(Apr 12 2020 at 14:45)</a>:</h4>
<p>or wait I just realized that this stream is wg-traits oops</p>



<a name="193715908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715908">(Apr 12 2020 at 14:45)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> fully concrete although I'm not sure about normalization</p>



<a name="193715956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715956">(Apr 12 2020 at 14:46)</a>:</h4>
<p>like <code>const NAME: &amp;'static &lt;Box&lt;str&gt; as Deref&gt;::Target</code></p>



<a name="193715960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715960">(Apr 12 2020 at 14:46)</a>:</h4>
<p>I think that sort of works right now but I'm not sure</p>



<a name="193715993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715993">(Apr 12 2020 at 14:46)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@Bastian Kauschke</span> ^^ do we have tests like that?</p>



<a name="193715997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193715997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193715997">(Apr 12 2020 at 14:46)</a>:</h4>
<p>with <code>&lt;... as Trait&gt;::Assoc</code> in the type of a <code>const</code> generic</p>



<a name="193716047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716047">(Apr 12 2020 at 14:48)</a>:</h4>
<p>I doubt it</p>



<a name="193716055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716055">(Apr 12 2020 at 14:48)</a>:</h4>
<p>Haven't had to look at all tests yet though</p>



<a name="193716057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716057">(Apr 12 2020 at 14:48)</a>:</h4>
<p>heh</p>



<a name="193716134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716134">(Apr 12 2020 at 14:51)</a>:</h4>
<p>My main question is more like "can unifying consts deduct something" or we just deduct all const types beforehand</p>



<a name="193716199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716199">(Apr 12 2020 at 14:53)</a>:</h4>
<p>unifying consts can deduct something from unevaluated consts</p>



<a name="193716204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716204">(Apr 12 2020 at 14:53)</a>:</h4>
<p>although idk if they should unify. it's like projections</p>



<a name="193716268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716268">(Apr 12 2020 at 14:54)</a>:</h4>
<p>but the const types are concrete for now anyway</p>



<a name="193716494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716494">(Apr 12 2020 at 15:01)</a>:</h4>
<p>Is that why </p>
<div class="codehilite"><pre><span></span>trait Tr1 { const N: u32; }
trait Tr2 { const N: f32; }

struct S {}

impl Tr1 for S { const N: u32 = 0; }
impl Tr2 for S { const N: f32 = 0.0; }

fn f() -&gt; u32 {
   S::N
}
</pre></div>


<p>is not working?</p>



<a name="193716551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716551">(Apr 12 2020 at 15:02)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> by the way thanks for blessing us with synstructure, it's awesome</p>



<a name="193716569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716569">(Apr 12 2020 at 15:03)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> that code has 0 const generics</p>



<a name="193716576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716576">(Apr 12 2020 at 15:03)</a>:</h4>
<p>associated consts are as simple as associated fn's (or even simpler) :P</p>



<a name="193716585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716585">(Apr 12 2020 at 15:03)</a>:</h4>
<p>also, lol, <code>synstructure</code> is just I've heard everyone was using for the past year or two or however long it's been</p>



<a name="193716626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716626">(Apr 12 2020 at 15:04)</a>:</h4>
<p>Yeah, but (presumably) it's not working because you can't use an inference variable as a type for S::N when deducting types</p>



<a name="193716675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716675">(Apr 12 2020 at 15:05)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> no, it's because we don't have trait inference variables :P</p>



<a name="193716690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716690">(Apr 12 2020 at 15:05)</a>:</h4>
<p>it should work if you use a type parameter for the associated const's type</p>



<a name="193716746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716746">(Apr 12 2020 at 15:06)</a>:</h4>
<p>this works fine, yeah:</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">Tr</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="nc">T</span><span class="p">;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">S</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">Tr</span><span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">S</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">u32</span> <span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">Tr</span><span class="o">&lt;</span><span class="kt">f32</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">S</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">f32</span> <span class="o">=</span><span class="w"> </span><span class="mf">0.0</span><span class="p">;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">u32</span> <span class="p">{</span><span class="w"></span>
<span class="w">   </span><span class="n">S</span>::<span class="n">N</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="193716938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716938">(Apr 12 2020 at 15:12)</a>:</h4>
<p>Hmm, I need to generate a more contrived example</p>



<a name="193716948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716948">(Apr 12 2020 at 15:13)</a>:</h4>
<p>but again this has nothing to do with constants in types</p>



<a name="193716955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716955">(Apr 12 2020 at 15:13)</a>:</h4>
<p>but it has to do with types in constants</p>



<a name="193716961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193716961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193716961">(Apr 12 2020 at 15:13)</a>:</h4>
<p>yeah but not in <em>the typesystem</em></p>



<a name="193717092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717092">(Apr 12 2020 at 15:16)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> <code>S::N</code> is inferred to be <code>&lt;S as Tr&lt;u32&gt;&gt;::N</code> but the <code>Tr::N</code> part of that would never reach Chalk</p>



<a name="193717099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717099">(Apr 12 2020 at 15:16)</a>:</h4>
<p>it'd just end up in MIR</p>



<a name="193717106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717106">(Apr 12 2020 at 15:17)</a>:</h4>
<p>you can't unify consts unless you put them inside types</p>



<a name="193717168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717168">(Apr 12 2020 at 15:19)</a>:</h4>
<p>Ok, I think I conjured a brittle image of what's happening in my mind, thanks</p>



<a name="193717222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717222">(Apr 12 2020 at 15:20)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> there is one detail that may be confusing: <code>ty::Const</code> in rustc is used for both type-level constants and MIR constants</p>



<a name="193717229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717229">(Apr 12 2020 at 15:21)</a>:</h4>
<p>I use it for both too, so I don't mind :)</p>



<a name="193717230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717230">(Apr 12 2020 at 15:21)</a>:</h4>
<p>so you can have a <code>ty::Const</code> with a polymorphic type or even a type with inference variables in it</p>



<a name="193717235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717235">(Apr 12 2020 at 15:21)</a>:</h4>
<p>but it's never unified with any other constant</p>



<a name="193717241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717241">(Apr 12 2020 at 15:21)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> okay now I am intrigued, is this about consts in Chalk or something else?</p>



<a name="193717242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717242">(Apr 12 2020 at 15:21)</a>:</h4>
<p>since AFAIK Chalk doesn't know about MIR</p>



<a name="193717288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717288">(Apr 12 2020 at 15:22)</a>:</h4>
<p>No I mean I use it for both associated consts and const params</p>



<a name="193717299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717299">(Apr 12 2020 at 15:23)</a>:</h4>
<p>Not ty::Const of course, my const</p>



<a name="193717302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717302">(Apr 12 2020 at 15:23)</a>:</h4>
<p>you mean it represents both?</p>



<a name="193717303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717303">(Apr 12 2020 at 15:23)</a>:</h4>
<p>Yeah</p>



<a name="193717306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717306">(Apr 12 2020 at 15:23)</a>:</h4>
<p>I'm talking about where <em>it's used</em></p>



<a name="193717307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717307">(Apr 12 2020 at 15:23)</a>:</h4>
<p>i.e. as a generic argument to an user-defined type or as an array length</p>



<a name="193717350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717350">(Apr 12 2020 at 15:24)</a>:</h4>
<p>i.e. if you write <code>Foo&lt;{S::N}&gt;</code> that's suddenly in the typesystem</p>



<a name="193717389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717389">(Apr 12 2020 at 15:25)</a>:</h4>
<p>more specifically it's <code>Foo&lt;main::{constant#0}: u32&gt;</code> assuming <code>struct Foo&lt;const X: u32&gt;;</code></p>



<a name="193717446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717446">(Apr 12 2020 at 15:26)</a>:</h4>
<p>and the MIR body of <code>main::{constant#0}</code> contains the constant <code>&lt;S as Tr&lt;u32&gt;&gt;::N: u32</code></p>



<a name="193717450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717450">(Apr 12 2020 at 15:26)</a>:</h4>
<p>I guess <code>S::N</code> is still not in the typesystem itself</p>



<a name="193717458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717458">(Apr 12 2020 at 15:27)</a>:</h4>
<p>and normalization would produce <code>Foo&lt;0: u32&gt;</code></p>



<a name="193717506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717506">(Apr 12 2020 at 15:28)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> but without a <code>const</code> generic parameter to <em>pass</em> a constant to, you can't have constants in the typesystem</p>



<a name="193717529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717529">(Apr 12 2020 at 15:29)</a>:</h4>
<p>Yeah, but chalk operates both, right?</p>



<a name="193717532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717532">(Apr 12 2020 at 15:29)</a>:</h4>
<p>what do you mean?</p>



<a name="193717578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717578">(Apr 12 2020 at 15:30)</a>:</h4>
<p>Maybe I don't understand the distinction you are making</p>



<a name="193717582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717582">(Apr 12 2020 at 15:30)</a>:</h4>
<p>Chalk would see <code>main::{constant#0}: u32</code> and <code>0: u32</code></p>



<a name="193717588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717588">(Apr 12 2020 at 15:31)</a>:</h4>
<p><code>S::N</code> aka <code>&lt;S as Tr&lt;u32&gt;&gt;::N</code> is <em>only</em> in a MIR body that Chalk can't see</p>



<a name="193717593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717593">(Apr 12 2020 at 15:31)</a>:</h4>
<p>Ooooh</p>



<a name="193717640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717640">(Apr 12 2020 at 15:32)</a>:</h4>
<p>I don't think rustc puts non-<code>AnonConst</code> <code>DefId</code>s into <code>ty::ConstKind::Unevaluated</code></p>



<a name="193717650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717650">(Apr 12 2020 at 15:33)</a>:</h4>
<p>we <em>could</em> refer to the assoc const directly but only after inferring all of the generic args to the path</p>



<a name="193717651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717651">(Apr 12 2020 at 15:33)</a>:</h4>
<p>And then if needed, mir would callback to chalk to get the value for S::N (if it was a more complicated projection)?</p>



<a name="193717653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717653">(Apr 12 2020 at 15:33)</a>:</h4>
<p>nope</p>



<a name="193717661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717661">(Apr 12 2020 at 15:33)</a>:</h4>
<p>miri would at most use Chalk to find which <code>const N</code> defines the value</p>



<a name="193717699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717699">(Apr 12 2020 at 15:34)</a>:</h4>
<p>Chalk itself wouldn't see it as a constant</p>



<a name="193717702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717702">(Apr 12 2020 at 15:34)</a>:</h4>
<p>it's the same as if miri wanted to call a method</p>



<a name="193717778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717778">(Apr 12 2020 at 15:36)</a>:</h4>
<p>So if it was <code>&lt;S as Trait&lt;S2::T&gt;&gt;::N</code> it wouldn't make a chalk query?</p>



<a name="193717787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717787">(Apr 12 2020 at 15:36)</a>:</h4>
<p>I mean, it would pass the <code>&lt;S as Trait&lt;S2::T&gt;&gt;</code> part to Chalk to find an <code>impl</code> that applies</p>



<a name="193717792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717792">(Apr 12 2020 at 15:36)</a>:</h4>
<p>idk how much of the specialization graph Chalk handles</p>



<a name="193717793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717793">(Apr 12 2020 at 15:36)</a>:</h4>
<p>Yeah, that's what I meant by "a more complicated projection"</p>



<a name="193717805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717805">(Apr 12 2020 at 15:37)</a>:</h4>
<p>but Chalk wouldn't be seeing the <code>N</code> associated constant like a type-level constant</p>



<a name="193717816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717816">(Apr 12 2020 at 15:37)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> I think it's better to imagine that Rust has this syntax: <code>const FOO&lt;A, B, C&gt;: ... = ...;</code></p>



<a name="193717856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717856">(Apr 12 2020 at 15:38)</a>:</h4>
<p>i.e. generic top-level <code>const</code> items</p>



<a name="193717883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717883">(Apr 12 2020 at 15:39)</a>:</h4>
<p>and ignoring associated consts as a weird special-case of that</p>



<a name="193717931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717931">(Apr 12 2020 at 15:40)</a>:</h4>
<p>even adding that syntax to Chalk's testing framework would be good IMO</p>



<a name="193717934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717934">(Apr 12 2020 at 15:40)</a>:</h4>
<p>minus the <code>= ...</code> part</p>



<a name="193717949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717949">(Apr 12 2020 at 15:41)</a>:</h4>
<p>Ooh, so for chalk there is no associated consts at all</p>



<a name="193717954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193717954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193717954">(Apr 12 2020 at 15:41)</a>:</h4>
<p>not to the extent that Chalk knows about associated <em>types</em>, no</p>



<a name="193718434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193718434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193718434">(Apr 12 2020 at 15:54)</a>:</h4>
<p>Ok, thanks a lot, my understanding has grown immensely</p>



<a name="193721870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193721870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193721870">(Apr 12 2020 at 17:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/144729-wg-traits/topic/const.20generics/near/193717816" title="#narrow/stream/144729-wg-traits/topic/const.20generics/near/193717816">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="251766">Areredify</span> I think it's better to imagine that Rust has this syntax: <code>const FOO&lt;A, B, C&gt;: ... = ...;</code></p>
</blockquote>
<p>I imagine this would be mostly (or entirely) the same as type aliases, from chalk's point of view</p>



<a name="193736283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193736283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193736283">(Apr 13 2020 at 00:04)</a>:</h4>
<p><span class="user-mention" data-user-id="125131">@detrumi</span> right, except Chalk can't know about the "RHS" of the alias</p>



<a name="193736287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193736287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193736287">(Apr 13 2020 at 00:04)</a>:</h4>
<p>since this is basically the "callback" (or really, primitive operation) <span class="user-mention" data-user-id="116009">@nikomatsakis</span> was talking about, where miri evaluates the MIR body of that "const alias"</p>



<a name="193770323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193770323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193770323">(Apr 13 2020 at 13:10)</a>:</h4>
<p>Is it true that chalk does not care about types of constants because we always get a well-formed program as input?</p>



<a name="193781278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193781278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193781278">(Apr 13 2020 at 15:09)</a>:</h4>
<p>hmmm</p>



<a name="193781340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193781340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193781340">(Apr 13 2020 at 15:10)</a>:</h4>
<p>depends on what "does not care" means</p>



<a name="193781422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193781422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193781422">(Apr 13 2020 at 15:11)</a>:</h4>
<p>I think you can just require in unification of constants that the types are exactly equal and maybe in WF of constants you'd check that their type is fully concrete or something</p>



<a name="193781583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193781583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193781583">(Apr 13 2020 at 15:12)</a>:</h4>
<p>Yeah, but I thought a lot and I could not come up with an example where we need const types for anything</p>



<a name="193781688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193781688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193781688">(Apr 13 2020 at 15:13)</a>:</h4>
<p>If all type constructor applications are well formed</p>



<a name="193781790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193781790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193781790">(Apr 13 2020 at 15:14)</a>:</h4>
<p>And from I understand, rustc guarantees them to be</p>



<a name="193801111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193801111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193801111">(Apr 13 2020 at 18:04)</a>:</h4>
<p>that I don't know about</p>



<a name="193801130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193801130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193801130">(Apr 13 2020 at 18:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> would know better</p>



<a name="193801255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193801255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193801255">(Apr 13 2020 at 18:05)</a>:</h4>
<p>but yeah I suppose you can get away without the type and just reason about parameters and const applications</p>



<a name="193802363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193802363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193802363">(Apr 13 2020 at 18:15)</a>:</h4>
<p>Hmm, I have encountered an interesting problem. So I have <code>I::ConstEvaluated</code> as a type that holds (who would've thought) evaluated constants. My approach was to make a function <code>interner.const_eq(c1, c2)</code> that checks if <code>c1 == c2</code></p>



<a name="193802492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193802492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193802492">(Apr 13 2020 at 18:16)</a>:</h4>
<p>So the problem is that I don't know how to fold <code>ConstEvaluated</code></p>



<a name="193803044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193803044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193803044">(Apr 13 2020 at 18:21)</a>:</h4>
<p>Oh wait</p>



<a name="193803065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193803065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193803065">(Apr 13 2020 at 18:21)</a>:</h4>
<p>This is what TargetInterner is for</p>



<a name="193803128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193803128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193803128">(Apr 13 2020 at 18:22)</a>:</h4>
<p>Pretend I said nothing</p>



<a name="193808779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193808779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193808779">(Apr 13 2020 at 19:11)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> you shouldn't need to, you can treat it as an opaque value that's equal if and only if <code>==</code> returns <code>true</code></p>



<a name="193808825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193808825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193808825">(Apr 13 2020 at 19:11)</a>:</h4>
<p>i.e. no substructure, just a leaf</p>



<a name="193808870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193808870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193808870">(Apr 13 2020 at 19:12)</a>:</h4>
<p>although I would call it <code>ConcreteConst</code> or <code>ConstValue</code> <em>shrug</em></p>



<a name="193815229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193815229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193815229">(Apr 13 2020 at 20:08)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> do you have a "WIP" branch here?</p>



<a name="193815854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193815854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193815854">(Apr 13 2020 at 20:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> made a draft pr</p>



<a name="193816065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193816065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193816065">(Apr 13 2020 at 20:15)</a>:</h4>
<p>I presumably added all the necessary parts, but I don't have way to test it because parser, so Im doing that at the moment</p>



<a name="193822684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193822684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193822684">(Apr 13 2020 at 21:18)</a>:</h4>
<p>presumably the testing part will have just integers?</p>



<a name="193822750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193822750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193822750">(Apr 13 2020 at 21:19)</a>:</h4>
<p>Yeah, I use u32 atm</p>



<a name="193834982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193834982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193834982">(Apr 13 2020 at 23:31)</a>:</h4>
<p>may I suggest <code>u128</code> :P</p>



<a name="193837944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193837944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193837944">(Apr 14 2020 at 00:14)</a>:</h4>
<p><code>exists&lt;#N&gt; { Foo&lt;#N&gt; = Foo&lt;42&gt; }</code> works <span aria-label="party ball" class="emoji emoji-1f38a" role="img" title="party ball">:party_ball:</span></p>



<a name="193837973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193837973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193837973">(Apr 14 2020 at 00:15)</a>:</h4>
<p>don't ask about the syntax</p>



<a name="193838464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193838464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193838464">(Apr 14 2020 at 00:22)</a>:</h4>
<div class="codehilite"><pre><span></span>program {
    struct Foo&lt;#N&gt; {}

    trait Trait&lt;#M&gt; {}

    impl&lt;#M&gt; Trait&lt;#M&gt; for Foo&lt;#M&gt; { }
}

goal {
    exists&lt;#N&gt; {
        Foo&lt;#N&gt;: Trait&lt;45&gt;
    }
} yields {
    &quot;Unique; substitution [?0 := 45], lifetime constraints []&quot;
}
</pre></div>


<p>works too</p>



<a name="193838976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193838976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193838976">(Apr 14 2020 at 00:30)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> do you have a special syntax symbol for consts by any chance?</p>



<a name="193839008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839008">(Apr 14 2020 at 00:31)</a>:</h4>
<p>uhhhhh</p>



<a name="193839017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839017">(Apr 14 2020 at 00:31)</a>:</h4>
<p>Like <code>'</code> for lifetimes</p>



<a name="193839020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839020">(Apr 14 2020 at 00:31)</a>:</h4>
<p><code>struct Foo&lt;const N&gt;</code></p>



<a name="193839028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839028">(Apr 14 2020 at 00:31)</a>:</h4>
<p>but not at use sites</p>



<a name="193839272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839272">(Apr 14 2020 at 00:35)</a>:</h4>
<p>I mean in debug output, not in code :P</p>



<a name="193839392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839392">(Apr 14 2020 at 00:37)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> print it <code>{N}</code> I guess</p>



<a name="193839405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839405">(Apr 14 2020 at 00:37)</a>:</h4>
<p>that's valid in actual Rust</p>



<a name="193839470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839470">(Apr 14 2020 at 00:38)</a>:</h4>
<p>most verbose that is still valid syntax would be</p>
<ul>
<li>defs: <code>const N: usize</code></li>
<li>uses: <code>{N: usize}</code></li>
</ul>



<a name="193839833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839833">(Apr 14 2020 at 00:43)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> where can I steal const generics tests?</p>



<a name="193839904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193839904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193839904">(Apr 14 2020 at 00:44)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> presumably <code>src/test/ui/const-generics</code> :P</p>



<a name="193875182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193875182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193875182">(Apr 14 2020 at 10:07)</a>:</h4>
<p>So presumably the const branch is working, I haven't done extensive testing but it works so far <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="193875246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193875246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193875246">(Apr 14 2020 at 10:08)</a>:</h4>
<p>even gats work</p>



<a name="193875513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193875513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193875513">(Apr 14 2020 at 10:10)</a>:</h4>
<p>the code for lifetimes and types is duplicated in a lot of places, and with consts it is now triplicated</p>



<a name="193875581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193875581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193875581">(Apr 14 2020 at 10:11)</a>:</h4>
<p>great! I did expect this to be fairly straightforward. Re: code dup, it'd be nice to see what we can do to reduce that, I agree.</p>



<a name="193875963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/193875963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#193875963">(Apr 14 2020 at 10:15)</a>:</h4>
<p>If you want to play with it, note that syntax for consts in types and applications is <code>$N</code>, I haven't implemented name resolution yet</p>



<a name="194364479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/194364479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#194364479">(Apr 16 2020 at 20:40)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> I left some comments on the PR</p>



<a name="194420637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/194420637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#194420637">(Apr 17 2020 at 10:24)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> btw I plan to leave some feedback on this pr and your other one today, I've been pushing them off slightly to get a few other "long standing" items merged</p>



<a name="195474828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195474828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195474828">(Apr 27 2020 at 21:04)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> at long last I'm taking a look at your PR!</p>



<a name="195474836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195474836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195474836">(Apr 27 2020 at 21:04)</a>:</h4>
<p>Sorry it stalled so long</p>



<a name="195479203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195479203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195479203">(Apr 27 2020 at 21:45)</a>:</h4>
<p>OK, so, I skimmed the code, and it all looked basically correct to me, <span class="user-mention" data-user-id="251766">@Areredify</span></p>



<a name="195479217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195479217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195479217">(Apr 27 2020 at 21:45)</a>:</h4>
<p>Obviously it needs more tests</p>



<a name="195479226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195479226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195479226">(Apr 27 2020 at 21:45)</a>:</h4>
<p>Do you have some idea what tests to add?</p>



<a name="195479234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195479234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195479234">(Apr 27 2020 at 21:45)</a>:</h4>
<p>Would it be helpful for me to try and make a list?</p>



<a name="195479422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195479422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195479422">(Apr 27 2020 at 21:47)</a>:</h4>
<p>Yes please, that would be very helpful</p>



<a name="195480237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195480237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195480237">(Apr 27 2020 at 21:55)</a>:</h4>
<p>Also concerning const types: I am still on the fence about it, if we don't have any clauses (besides const equality) about constants and all constants only appear in type expressions, we don't really need types of those consts, do we?</p>



<a name="195480670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195480670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195480670">(Apr 27 2020 at 22:00)</a>:</h4>
<p>If everything passed from rustc to chalk is well-formed, I can't think of a place where we need const types</p>



<a name="195480801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195480801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195480801">(Apr 27 2020 at 22:02)</a>:</h4>
<p>it's fine in this PR to remove</p>



<a name="195480808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195480808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195480808">(Apr 27 2020 at 22:02)</a>:</h4>
<p>as we move towards reconciling the types that chalk and rustc use</p>



<a name="195480809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195480809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195480809">(Apr 27 2020 at 22:02)</a>:</h4>
<p>we may find we want it</p>



<a name="195481307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195481307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195481307">(Apr 27 2020 at 22:08)</a>:</h4>
<p>I have a branch with const types, <code>Binders&lt;T, I&gt;</code> is <span aria-label="crying cat" class="emoji emoji-1f63f" role="img" title="crying cat">:crying_cat:</span></p>



<a name="195481337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195481337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195481337">(Apr 27 2020 at 22:09)</a>:</h4>
<p>Oh, <code>T</code> is <code>HasInterner</code> now anyways</p>



<a name="195481375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195481375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195481375">(Apr 27 2020 at 22:09)</a>:</h4>
<p>Then it won't be too bad if we add it</p>



<a name="195481933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195481933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195481933">(Apr 27 2020 at 22:15)</a>:</h4>
<p>I would definitely not want to have <code>Binders&lt;T, I&gt;</code></p>



<a name="195564114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195564114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195564114">(Apr 28 2020 at 13:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Also, is it ok to leave consts to be declared and used as <code>$N</code> or should I implement name resolution? On one hand, we should of course match Rust syntax, on the other I like the <code>$</code> more and (for me) it improves readability in tests</p>



<a name="195615347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195615347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195615347">(Apr 28 2020 at 19:40)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> I'm not sure I totally follow</p>



<a name="195615415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195615415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195615415">(Apr 28 2020 at 19:40)</a>:</h4>
<p>I guess that rust syntax is something like</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="195615430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195615430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195615430">(Apr 28 2020 at 19:40)</a>:</h4>
<p>and the point is that we have to accommodate the case that <code>N</code> might be a const and might not?</p>



<a name="195615726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195615726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195615726">(Apr 28 2020 at 19:42)</a>:</h4>
<p>Yeah</p>



<a name="195616007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195616007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195616007">(Apr 28 2020 at 19:45)</a>:</h4>
<p>I guess I think we should match Rust syntax, I don't think it would be too hard to get the name resolution right</p>



<a name="195616023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195616023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195616023">(Apr 28 2020 at 19:45)</a>:</h4>
<p>but I'd be ok to do it in a follow-up</p>



<a name="195616097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195616097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195616097">(Apr 28 2020 at 19:45)</a>:</h4>
<p>eh, I'll have to write tests anyway, so it's not big deal to add while Im at it</p>



<a name="195618420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195618420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195618420">(Apr 28 2020 at 20:01)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> started working on a <a href="https://hackmd.io/Ah_J6nFQSbuUiVOsH5acLg" title="https://hackmd.io/Ah_J6nFQSbuUiVOsH5acLg">list of test cases</a> but didn't get <em>that</em> far yet</p>



<a name="195627406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627406">(Apr 28 2020 at 21:09)</a>:</h4>
<p>OK, I guess that'll do for now for tests</p>



<a name="195627471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627471">(Apr 28 2020 at 21:10)</a>:</h4>
<p>er, I didn't think about associated constants</p>



<a name="195627516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627516">(Apr 28 2020 at 21:10)</a>:</h4>
<p>wait, we probably didn't add support for that</p>



<a name="195627520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627520">(Apr 28 2020 at 21:10)</a>:</h4>
<p>just GATs?</p>



<a name="195627536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627536">(Apr 28 2020 at 21:10)</a>:</h4>
<p>that is actually a "to do" item we should include at some point</p>



<a name="195627577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627577">(Apr 28 2020 at 21:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/const.20generics/near/195627520" title="#narrow/stream/144729-wg-traits/topic/const.20generics/near/195627520">said</a>:</p>
<blockquote>
<p>just GATs?</p>
</blockquote>
<p>this presumably just kind of "falls out"</p>



<a name="195627618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627618">(Apr 28 2020 at 21:11)</a>:</h4>
<p>@eddyb said that we don't need them in chalk for anything really</p>



<a name="195627652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627652">(Apr 28 2020 at 21:11)</a>:</h4>
<p>so I didn't bother adding them</p>



<a name="195627661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627661">(Apr 28 2020 at 21:11)</a>:</h4>
<p>should I do that?</p>



<a name="195627662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627662">(Apr 28 2020 at 21:12)</a>:</h4>
<p>/me thinks</p>



<a name="195627741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627741">(Apr 28 2020 at 21:12)</a>:</h4>
<p>That doesn't seem true to me :)</p>



<a name="195627756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627756">(Apr 28 2020 at 21:12)</a>:</h4>
<p>like, if you have associated constants, it seems like chalk would have to resolve them</p>



<a name="195627790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627790">(Apr 28 2020 at 21:12)</a>:</h4>
<p>I think we should add them, yes</p>



<a name="195627799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627799">(Apr 28 2020 at 21:13)</a>:</h4>
<p>but not in this PR</p>



<a name="195627828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627828">(Apr 28 2020 at 21:13)</a>:</h4>
<p><a href="#narrow/stream/144729-wg-traits/topic/const.20generics/near/193717588" title="#narrow/stream/144729-wg-traits/topic/const.20generics/near/193717588">https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/const.20generics/near/193717588</a></p>



<a name="195627924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627924">(Apr 28 2020 at 21:14)</a>:</h4>
<p>yeah but</p>



<a name="195627941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627941">(Apr 28 2020 at 21:14)</a>:</h4>
<p>somebody has to map that to an impl</p>



<a name="195627943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627943">(Apr 28 2020 at 21:14)</a>:</h4>
<p>and that should obviously be chalk</p>



<a name="195627968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627968">(Apr 28 2020 at 21:14)</a>:</h4>
<p>so at some point, there's going to be a 'normalization' operation on that</p>



<a name="195627978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195627978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195627978">(Apr 28 2020 at 21:14)</a>:</h4>
<p>it's true that we probably don't need it to start</p>



<a name="195628023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628023">(Apr 28 2020 at 21:15)</a>:</h4>
<p>(and it maybe makes some sense to wait until the picture is a bit more complete)</p>



<a name="195628039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628039">(Apr 28 2020 at 21:15)</a>:</h4>
<p>but I think that it's kind of clear what it will look like for chalk</p>



<a name="195628082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628082">(Apr 28 2020 at 21:15)</a>:</h4>
<p>there will be some <code>Normalize(&lt;P0 as Trait&lt;P1..Pn&gt;&gt;::CONSTANT -&gt; Value)</code> rules</p>



<a name="195628102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628102">(Apr 28 2020 at 21:15)</a>:</h4>
<p>added, from an impl, for each associated const</p>



<a name="195628180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628180">(Apr 28 2020 at 21:16)</a>:</h4>
<p>Eddyb said that to resolve &lt;S as Trait&gt;::N mir will callback to typeck with &lt;S as Trait&gt;, get the type, and then mir will get the associated const from the type by itself</p>



<a name="195628214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628214">(Apr 28 2020 at 21:16)</a>:</h4>
<p>But I guess your setup makes more sense</p>



<a name="195628276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628276">(Apr 28 2020 at 21:17)</a>:</h4>
<p>that's not correct</p>



<a name="195628285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628285">(Apr 28 2020 at 21:17)</a>:</h4>
<p>it does map to the older trait solver</p>



<a name="195628290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628290">(Apr 28 2020 at 21:17)</a>:</h4>
<p>Doesn't seem very "lazy normalized" without it</p>



<a name="195628310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628310">(Apr 28 2020 at 21:17)</a>:</h4>
<p>in particular, in that trait solver, you can ask things like "&lt;S as Trait&gt;" and it gives you an impl</p>



<a name="195628368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628368">(Apr 28 2020 at 21:18)</a>:</h4>
<p>but in chalk, that's not how it works, and I'd rather keep it that way</p>



<a name="195628392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628392">(Apr 28 2020 at 21:18)</a>:</h4>
<p>(so we'd need to add a goal that the impl lets you prove, like <code>Normalize</code>)</p>



<a name="195628634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195628634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195628634">(Apr 28 2020 at 21:20)</a>:</h4>
<p>Should I add const types as a follow-up or in current pr?</p>



<a name="195629445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195629445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195629445">(Apr 28 2020 at 21:27)</a>:</h4>
<p>Either works for me</p>



<a name="195629461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195629461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195629461">(Apr 28 2020 at 21:27)</a>:</h4>
<p>I guess might as well do it now</p>



<a name="195630780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195630780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195630780">(Apr 28 2020 at 21:40)</a>:</h4>
<p>A side question: do fully instantiated types have a "normal form" (I really want to know if  <code>==</code>'ing types of consts is possible)</p>



<a name="195630838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195630838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195630838">(Apr 28 2020 at 21:40)</a>:</h4>
<p>not really</p>



<a name="195630847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195630847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195630847">(Apr 28 2020 at 21:40)</a>:</h4>
<p>or at least not a trivial one</p>



<a name="195630866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195630866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195630866">(Apr 28 2020 at 21:41)</a>:</h4>
<p>this falls out from <code>fn(&amp;u32, &amp;u32)</code> and <code>for&lt;'a&gt; fn(&amp;'a u32, &amp;'a u32)</code> being equivalent</p>



<a name="195631898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195631898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195631898">(Apr 28 2020 at 21:50)</a>:</h4>
<p>I should probably read stacked borrows first to think properly about this</p>



<a name="195633630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195633630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195633630">(Apr 28 2020 at 22:03)</a>:</h4>
<p>I'm not sure that's required</p>



<a name="195738701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195738701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195738701">(Apr 29 2020 at 16:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> am I correct in that in chalk we assume all consts to have infinite values of their type?</p>



<a name="195738874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195738874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195738874">(Apr 29 2020 at 16:49)</a>:</h4>
<p>I think that's what λProlog does, right?</p>



<a name="195739242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195739242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195739242">(Apr 29 2020 at 16:53)</a>:</h4>
<p>do you mean like, will we enumerate bool to true/false?</p>



<a name="195739277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195739277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195739277">(Apr 29 2020 at 16:53)</a>:</h4>
<p>if so, you are correct, we do the same for types</p>



<a name="195739364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195739364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195739364">(Apr 29 2020 at 16:54)</a>:</h4>
<p>e.g., with <code>forall&lt;T&gt; { .. }</code>, we don't go trying to enumerate all the types that exist</p>



<a name="195739413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195739413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195739413">(Apr 29 2020 at 16:54)</a>:</h4>
<p>Yeah that's what I meant, with types it's kinda self-evident, with consts less so (for me)</p>



<a name="195739443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195739443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195739443">(Apr 29 2020 at 16:54)</a>:</h4>
<p>agreed, nonetheless, I would keep that behavior</p>



<a name="195764719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195764719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195764719">(Apr 29 2020 at 20:20)</a>:</h4>
<p>Well, I don't have <code>Binders&lt;T, I&gt;</code> this time, but I do have <code>ParameterKinds&lt;I, T&gt;</code> <span aria-label="crying cat" class="emoji emoji-1f63f" role="img" title="crying cat">:crying_cat:</span></p>



<a name="195824737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/195824737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#195824737">(Apr 30 2020 at 11:12)</a>:</h4>
<p>Const types are up, everybody is welcome to leave a review <span aria-label="smile" class="emoji emoji-263a" role="img" title="smile">:smile:</span></p>



<a name="196222433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196222433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196222433">(May 04 2020 at 18:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I think zulip is a better fit for our github convo, do you have time to discuss it?</p>



<a name="196223084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223084">(May 04 2020 at 18:45)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> yep, I'd like to see this branch land.</p>



<a name="196223617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223617">(May 04 2020 at 18:48)</a>:</h4>
<p>Although I think I'm starting to see your point --</p>



<a name="196223642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223642">(May 04 2020 at 18:48)</a>:</h4>
<p>So, I thought about not having const type in parameter kind when implementing, but it is in some sense backwards</p>



<a name="196223748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223748">(May 04 2020 at 18:49)</a>:</h4>
<p>hmm</p>



<a name="196223751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223751">(May 04 2020 at 18:49)</a>:</h4>
<p>Each bound var would carry a ty, but the binder variable they are referring to does not, which is... strange</p>



<a name="196223820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223820">(May 04 2020 at 18:49)</a>:</h4>
<p>Same for universes and inference vars</p>



<a name="196223853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223853">(May 04 2020 at 18:49)</a>:</h4>
<p>I guess the question is whether the "kind" of the variable (in the type theory sense) includes the type or not</p>



<a name="196223989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196223989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196223989">(May 04 2020 at 18:50)</a>:</h4>
<p>is it <code>impl&lt;const C: usize&gt;</code> or <code>impl&lt;const C&gt; where C is a usize</code></p>



<a name="196224007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224007">(May 04 2020 at 18:50)</a>:</h4>
<p>Yes</p>



<a name="196224057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224057">(May 04 2020 at 18:51)</a>:</h4>
<p>At first I thought it was a no-brainer (of course it does, duh), but now I am less sure</p>



<a name="196224060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224060">(May 04 2020 at 18:51)</a>:</h4>
<p>I'm a bit surprised I never noticed this question in rustc before</p>



<a name="196224224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224224">(May 04 2020 at 18:52)</a>:</h4>
<p>in rustc, when we create inference variables...</p>



<a name="196224231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224231">(May 04 2020 at 18:52)</a>:</h4>
<p>they don't see to carry a type</p>



<a name="196224249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224249">(May 04 2020 at 18:52)</a>:</h4>
<p>I'm not yet sure why it <em>can't</em> be <code>C is a usize</code></p>



<a name="196224264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224264">(May 04 2020 at 18:52)</a>:</h4>
<p>ah well</p>



<a name="196224272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224272">(May 04 2020 at 18:52)</a>:</h4>
<p>I mean, it can</p>



<a name="196224277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224277">(May 04 2020 at 18:53)</a>:</h4>
<p>ok, so, I guess that when we instantiate a constant in rustc</p>



<a name="196224303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224303">(May 04 2020 at 18:53)</a>:</h4>
<p>it carries a type but not "in the inference variable", so to speak</p>



<a name="196224361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224361">(May 04 2020 at 18:53)</a>:</h4>
<p>I can see why chalk's setup</p>



<a name="196224376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224376">(May 04 2020 at 18:53)</a>:</h4>
<p>which tries to unify the logic across types/lifetimes</p>



<a name="196224388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224388">(May 04 2020 at 18:53)</a>:</h4>
<p>will then run aground here</p>



<a name="196224520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224520">(May 04 2020 at 18:54)</a>:</h4>
<p>right, so conceivably</p>



<a name="196224539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224539">(May 04 2020 at 18:55)</a>:</h4>
<p>the "type" could move into a combination of a <em>where clause</em> and something attached to the <em>value</em> itself</p>



<a name="196224569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224569">(May 04 2020 at 18:55)</a>:</h4>
<p>i.e., if the value of a constant is some set of bits and needs a type for interpretation, it can be there</p>



<a name="196224623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224623">(May 04 2020 at 18:55)</a>:</h4>
<p>we would need the where-clause to make this an error:</p>



<a name="196224678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224678">(May 04 2020 at 18:56)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="n">exists</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">C</span>: <span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">C</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">22_</span><span class="k">i32</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="196224703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224703">(May 04 2020 at 18:56)</a>:</h4>
<p>and really the above would be more like</p>



<a name="196224727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224727">(May 04 2020 at 18:56)</a>:</h4>
<div class="codehilite"><pre><span></span><code>exists&lt;const C&gt; { HasType(C: u32), C = 22_i32 }
</code></pre></div>



<a name="196224822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224822">(May 04 2020 at 18:57)</a>:</h4>
<p>similarly </p>
<div class="codehilite"><pre><span></span><code>impl&lt;const C: usize&gt; {
}
</code></pre></div>


<p>is kind of</p>
<div class="codehilite"><pre><span></span><code>forall&lt;const C&gt; { if (HasType(C: usize)) { ... } }
</code></pre></div>



<a name="196224857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224857">(May 04 2020 at 18:57)</a>:</h4>
<p>Does that sound like a viable alternative to you?</p>



<a name="196224867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224867">(May 04 2020 at 18:57)</a>:</h4>
<p>It feels "more elegant" to me, though clearly different from what rustc is doing</p>



<a name="196224947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224947">(May 04 2020 at 18:58)</a>:</h4>
<p>it has some strange implications</p>



<a name="196224969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224969">(May 04 2020 at 18:58)</a>:</h4>
<p>e.g., if you reference <code>C</code> as an expression, it needs a type</p>



<a name="196224979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224979">(May 04 2020 at 18:58)</a>:</h4>
<p>but under this setup it can conceivably have multiple types</p>



<a name="196224983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196224983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196224983">(May 04 2020 at 18:58)</a>:</h4>
<p>or none</p>



<a name="196225012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225012">(May 04 2020 at 18:58)</a>:</h4>
<p>Well, I always thought of const sort to be { C } (singleton) x Ty</p>



<a name="196225216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225216">(May 04 2020 at 19:00)</a>:</h4>
<p>I gotta run for a bit but</p>



<a name="196225264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225264">(May 04 2020 at 19:00)</a>:</h4>
<p>I guess I have to think about this</p>



<a name="196225274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225274">(May 04 2020 at 19:01)</a>:</h4>
<p>and re-read your commits now that I understand better the problem</p>



<a name="196225275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225275">(May 04 2020 at 19:01)</a>:</h4>
<p>From the theoretical standpoint, I don't like it</p>



<a name="196225323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225323">(May 04 2020 at 19:01)</a>:</h4>
<p>I would prefer consts to be a collection of different sorts</p>



<a name="196225372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225372">(May 04 2020 at 19:01)</a>:</h4>
<p>Yeah, it seems to lose something "important" to have them be untyped</p>



<a name="196225456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225456">(May 04 2020 at 19:02)</a>:</h4>
<p>though from an engineering pov I also don't love having <code>ParameterKind</code> carry extra data</p>



<a name="196225469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225469">(May 04 2020 at 19:02)</a>:</h4>
<p>that can't be stuffed into the lots bits of a pointer</p>



<a name="196225523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196225523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196225523">(May 04 2020 at 19:02)</a>:</h4>
<p>(that's how rustc handles this case)</p>



<a name="196229105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196229105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196229105">(May 04 2020 at 19:32)</a>:</h4>
<p>So, the alternatives I see are:</p>
<ol start="0">
<li>Leave everything as is, "as is" being: we carry a <code>Ty</code> in both <code>ParameterKind::Const</code> and <code>ConstData</code>, we always know the type of everything at any time.</li>
<li>Have untyped consts with an ambient clause about their type, which is weird from the theoretical standpoint and implementation wise is also weird (also we would have to push a goal when we unify stuff? or that would be resolved with syn-sem lowering) </li>
<li>Store type only in binders and in concrete consts. The idea is to store the type only if we have to, and if we want the type of a bound var we go to the binder and fetch it</li>
<li>Wild west of untyped consts, we assume everything to be well formed and then we don't have to care about it</li>
<li>Don't use <code>ParameterKind</code> for <code>Parameter</code> and use <code>enum ParameterKind2.0 { Ty(Ty), Lifetime(Lifetime), Const(Const) }</code> instead</li>
<li>Something else?</li>
</ol>



<a name="196232061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232061">(May 04 2020 at 19:55)</a>:</h4>
<p>So, I think option 4 we want to do anyway</p>



<a name="196232067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232067">(May 04 2020 at 19:55)</a>:</h4>
<p>eventually</p>



<a name="196232077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232077">(May 04 2020 at 19:55)</a>:</h4>
<p>but I think that's not the interesting part, right?</p>



<a name="196232196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232196">(May 04 2020 at 19:56)</a>:</h4>
<p>like, the relevant part was more the cases like <code>ParameterKind&lt;EnaVariable&gt;</code> or <code>ParameterKind&lt;()&gt;</code></p>



<a name="196232232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232232">(May 04 2020 at 19:56)</a>:</h4>
<p>as you pointed out, <code>Binders</code> does indeed need to carry the <em>type</em> of the constant</p>



<a name="196232556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232556">(May 04 2020 at 19:59)</a>:</h4>
<p>I don't quite get why you think Option 1 is weird from a theoretical/implementation standpoint, it doesn't strike me as so weird -- my main concern there though is that it admits a lot of things that don't "map back up" to the Rust standpoint, where every constant has a type. In particular, I think it might be weird more in rustc, if we are sharing some of these core types.</p>
<p>From chalk's POV, I think it's basically the same as 3 -- we're saying that constants don't have types, but that any particular constant <em>value</em> has a type, and that there's this <code>HasType</code> predicate we can prove about constants (and we know how to prove it for constant <em>values</em>).</p>



<a name="196232629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232629">(May 04 2020 at 20:00)</a>:</h4>
<p>(Not to say I favor that approach, I'm just not quite sure I see the problem's you are alluding to.)</p>



<a name="196232714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232714">(May 04 2020 at 20:00)</a>:</h4>
<p>I mean weird stuff that you pointed out: constants having many types or no type</p>



<a name="196232988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196232988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196232988">(May 04 2020 at 20:03)</a>:</h4>
<p>Maybe you are right in that it's not that weird from the implementation standpoint, we could make it work</p>



<a name="196233072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196233072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196233072">(May 04 2020 at 20:04)</a>:</h4>
<p>(Not to say that I favor this approach either)</p>



<a name="196233792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196233792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196233792">(May 04 2020 at 20:09)</a>:</h4>
<p>Yeah, I think it can work, but it's not great that chalk would be able to accommodate things that don't map to Rust</p>



<a name="196235875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196235875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196235875">(May 04 2020 at 20:29)</a>:</h4>
<p>Personally, I am inclined to pick 0/4 (as you pointed out, we would want to do 4 anyway)</p>



<a name="196237008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196237008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196237008">(May 04 2020 at 20:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Should we just put it on the agenda tomorrow and think of alternatives until the meeting?</p>



<a name="196238017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196238017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196238017">(May 04 2020 at 20:47)</a>:</h4>
<p>Sure. It still seems to me, though, that 4 is orthogonal.</p>



<a name="196238033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196238033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196238033">(May 04 2020 at 20:47)</a>:</h4>
<p>I think there is a "5"</p>



<a name="196238078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196238078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196238078">(May 04 2020 at 20:48)</a>:</h4>
<p>Which is to try and match how rustc handles this situation</p>



<a name="196238140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196238140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196238140">(May 04 2020 at 20:48)</a>:</h4>
<p>Which would mean that we put <code>ty</code> into the <code>ConstData</code> struct</p>



<a name="196238201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196238201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196238201">(May 04 2020 at 20:49)</a>:</h4>
<p>Hmm, erm, no I mean that still leaves us with the need to include types in binders</p>



<a name="196238217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196238217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196238217">(May 04 2020 at 20:49)</a>:</h4>
<p>yeah, ok, never mind.</p>



<a name="196239346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196239346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196239346">(May 04 2020 at 20:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/const.20generics/near/196238017" title="#narrow/stream/144729-wg-traits/topic/const.20generics/near/196238017">said</a>:</p>
<blockquote>
<p>Sure. It still seems to me, though, that 4 is orthogonal.</p>
</blockquote>
<p>That's what I meant (sorry, I have terrible communicating/explaining skills, even in my native tongue; my sometimes broken english doesn't help)</p>



<a name="196916959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196916959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196916959">(May 08 2020 at 16:22)</a>:</h4>
<p>So I was thinking about this --</p>



<a name="196917276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196917276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196917276">(May 08 2020 at 16:24)</a>:</h4>
<p>I was thinking that maybe a good "next step" <span class="user-mention" data-user-id="251766">@Areredify</span> would be to create a PR that</p>
<ul>
<li>replaces <code>type Parameter = ParameterKind&lt;...&gt;</code> with a <code>GenericArg</code> (copying Rust's name) -- for bonus points, it should be an interned struct as well with a <code>data</code> method that gets a <code>GenericArgData</code></li>
<li>and refactors <code>ParameterKind&lt;()&gt;</code> into <code>BoundVariableKind&lt;I&gt;</code> or something like (which for now is just type/lifetime and I guess a phantomdata for the <code>I</code> parameter)</li>
<li>and refactors <code>ParameterKind&lt;EnaVariable&gt;</code> into a <code>(BoundVariableKind, EnaVariable)</code> pair</li>
</ul>
<p>Then we can, in the const generics PR:</p>
<ul>
<li>extend <code>BoundVariableKind</code> with <code>Const(Ty&lt;I&gt;)</code></li>
<li>extend <code>GenericArg</code> with a <code>Const(Const&lt;I&gt;)</code> variable, and <code>Const&lt;I&gt;</code> can carry the <code>Ty&lt;I&gt;</code> (as rustc handles it)</li>
</ul>



<a name="196917289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196917289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196917289">(May 08 2020 at 16:24)</a>:</h4>
<p>What do you think of that?</p>



<a name="196917656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196917656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196917656">(May 08 2020 at 16:28)</a>:</h4>
<p>Makes sense</p>



<a name="196918051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196918051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196918051">(May 08 2020 at 16:31)</a>:</h4>
<p>I'll go do that tomorrow, then</p>



<a name="196918153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196918153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196918153">(May 08 2020 at 16:32)</a>:</h4>
<p>If I rebase const pr to that new branch then I won't have to rebase when it lands?</p>



<a name="196931742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196931742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196931742">(May 08 2020 at 18:19)</a>:</h4>
<p>Not sure I understand</p>



<a name="196933431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196933431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196933431">(May 08 2020 at 18:34)</a>:</h4>
<p>Can I rebase my const generics branch on top of my local branch for the refactoring (after it's done), so after landing the refactoring branch I won't have to rebase my const branch on top of master?</p>



<a name="196933842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196933842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196933842">(May 08 2020 at 18:38)</a>:</h4>
<p>yes</p>



<a name="196933859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196933859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196933859">(May 08 2020 at 18:38)</a>:</h4>
<p>that is indeed what I would expect you to do :)</p>



<a name="196969280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/196969280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#196969280">(May 09 2020 at 02:35)</a>:</h4>
<p>Hmm, do we want to name it <code>BoundVariableKind</code>? It implies that it's related to <code>BoundVar</code>, even though we will use it in inference contexts and universes (of course, inference vars and placeholders are, in a sense, bound in the corresponding inference context/universe, but it wouldn't be my first guess)</p>



<a name="197212062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/197212062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#197212062">(May 11 2020 at 22:20)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span> I'm open to other names :)</p>



<a name="197212096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/197212096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#197212096">(May 11 2020 at 22:20)</a>:</h4>
<p>maybe just <code>VariableKind</code>?</p>



<a name="197491690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/197491690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#197491690">(May 13 2020 at 23:47)</a>:</h4>
<p>Halfway into doing this I realized that maybe instead of using <code>(VariableKind, EnaVariable) </code> type we can use</p>
<div class="codehilite"><pre><span></span><code>KindedData&lt;I, T&gt; {
   kind: VariableKind&lt;I&gt;,
   data: T,
}
</code></pre></div>



<a name="197491795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/197491795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#197491795">(May 13 2020 at 23:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> what do you think?</p>



<a name="197492287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/197492287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#197492287">(May 13 2020 at 23:54)</a>:</h4>
<p>probably a dumb question, <code>KindedData</code> is obviously better than a pair in every way and allows us to keep <code>map</code> and other cool stuff, I am going to go with it (but tomorrow :P)</p>



<a name="197536590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/197536590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#197536590">(May 14 2020 at 10:51)</a>:</h4>
<p>Yes, a named struct is better, agreed.</p>



<a name="197536633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/const%20generics/near/197536633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/const.20generics.html#197536633">(May 14 2020 at 10:51)</a>:</h4>
<p>I would probably call it <code>WithKind</code> or something but doesn't matter</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>